<template>
  <div>
    <h2>添加挂号级别</h2>
    <el-form :model="numberValidateForm" ref="numberValidateForm" label-width="80x" class="demo-ruleForm">
      <el-form-item label="号别编码" prop="registCode" :rules="[
          { required: true, message: '号别编码不能为空'},
          { type: 'number', message: '号别编码必须为数字值'}
        ]">
        <el-input v-model="addregistLevel.ID" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="号别名称" prop="registName" :rules="[
          { required: true, message: '号别名称不能为空'},
        ]">
        <el-input v-model="addregistLevel.RegistCode" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="挂号费" prop="registFee" :rules="[
          { required: true, message: '挂号费不能为空'},
        ]">
        <el-input v-model="addregistLevel.RegistFee" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="挂号限额" prop="registQuota" :rules="[
          { required: true, message: '挂号限额不能为空'},
        ]">
        <el-input v-model="addregistLevel.registQuota" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="排序序号" prop=" sequenceNo ">
        <el-input v-model.number="addregistLevel.sequenceNo" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm('numberValidateForm')">添加</el-button>
        <el-button @click="resetForm('addregistLevel')">重置</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
  import registLevel from '@/api/his/registLevel';
  export default {
    data() {
      return {
        numberValidateForm: {
          age: ''
        },
        //添加对象
        addregistLevel: {
          ID: 0,
          RegistCode: '',
          RegistName: '',
          SequenceNo: '',
          RegistFee: '',
          RegistQuota: '',
          DelMark: 1
        },
      };
    },
    methods: {
      submitForm(formName) {
        this.addsaveRregistLevel();
        this.$refs[formName].validate((valid) => {
          if (valid) {
            alert('submit!');
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      },
      //添加
      addsaveRregistLevel() {
        registLevel.getadd(this.addregistLevel).then((res) => {
          console.log(res)
          if(res.data.data.save==true){
            alert("添加成功")
  
          }else{
            alert("添加失败")
          }
        })
      }

    }
  }
</script>

<style lang="less" scoped>

</style>
